#include <iostream>
#include "../head/TreeNode.h"

using namespace std;

// 111: Minmum Depth of Binary Tree
class Solution {
public:
    int maxDepth(TreeNode* root) {
		if(root == NULL) return 0;
        if(root->left == NULL && root->right == NULL) return 1;
        else if(root->left == NULL && root->right != NULL) return 1 + minDepth(root->right);
        else if(root->left != NULL && root->right == NULL) return 1 + minDepth(root->left);
        else return 1 + min(minDepth(root->left), minDepth(root->right)); 
    }
};
